package cs342.project1.mathNotebook.data;

import java.io.*;
import java.util.*;

import cs342.project1.mathNotebook.expressions.*;

public class ExpressionParser {
    private StringTokenizer tokenizer;

    private Stack<Expr> outputQueue;
    private Stack<String> operandStack;

    public ExpressionParser() {
    }

    public Expr parse(String input) {
	outputQueue = new Stack<Expr>();
	operandStack = new Stack<String>();

	Scanner scanner = new Scanner(input);

	while (scanner.hasNext()) {
	    if (scanner.hasNextDouble()) {
		outputQueue.push(new LiteralExpr(scanner.nextDouble()));
		continue;
	    }

	    String operand = scanner.next();

	    if (operand.equals("(")) {
		this.operandStack.push(operand);
	    } else if (operand.equals(")")) {
		while (operandStack.peek() != "(") {

		}
	    }

	    /*
	     * if (scanner.) else if (this.properties.containsKey(""))
	     */

	    String token = scanner.next();
	    if (token.equals("+")) {
		// stack.push(new AddExpr(stack.pop(), stack.pop()));
	    } else if (token.equals("-")) {
		// tmp = stack.pop();
		// stack.push(new SubExpr(stack.pop(), tmp));
	    }
	}
	return null;
	// return stack.pop();
    }
}